pythonrequest能不能自动解码gzip网!

pythonrequest能不能自动解码gzip网

趋势迷

pythonrequest能不能自动解码gzip

2024-08-17 04:40:24 来源:网络

pythonrequest能不能自动解码gzip

python request能不能自动解码gzip -
import urllib.request import gzip def getUrlContent(url):返回页面内容doc = urllib.request.urlopen(url).read()解码try:html=gzip.decompress(doc).decode("utf-8")except:html=doc.decode("utf-8")return html

pythonrequest能不能自动解码gzip